﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ProjectBasicInfo>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<% if (false)
   { %>
<script src="jquery-vsdoc.js" type="text/javascript"></script>
<script src="jquery-ui-1.8.custom.min.js" type="text/javascript"></script>
<script src="jquery.form.js" type="text/javascript"></script>
<%} %>


    <script type="text/javascript" src="<%= Url.EzDeskUrl("Project", "/Scripts/gserializer.js", null) %>"></script>
    <script type="text/javascript" src="<%= Url.EzDeskUrl("Project", "/Scripts/dhtmlxgantt.js", null) %>"></script>
    <script type="text/javascript" src="<%= Url.EzDeskUrl("Project", "/Scripts/dhtmlxgantt.ext.js", null) %>"></script>

    <link href="<%= Url.EzDeskUrl("Project", "/Content/dhtmlxgantt.css", null) %>" rel="stylesheet" type="text/css" />
    

<script type="text/javascript">


    var URL_GetGanttProjectModel = '<%= Url.EzDeskUrl("Project", "/GetProjectDetailJsonView", "ajax") %>';
    var URL_SaveGanttProjectModel = '<%= Url.EzDeskUrl("Project", "/SaveProjectDetailJsonView", "ajax") %>';
    var ganttChartControl = new GanttChart();

    $(function () {

        $('#btnRefreshGantt').click(function () {
            $.getJSON(URL_GetGanttProjectModel, { projectId: '<%: Model.Id %>' }, function (serverData) {
                //alert(e.Planes[0].childTasks);
                ganttChartControl.loadDataIn('ganttContainer', serverData);
            });
        });

        $('#btnSaveToServer').click(function () {
            var dataToServer = ganttChartControl.getServerData();
            var jsonText = JSON.stringify(dataToServer);

            $.post(URL_SaveGanttProjectModel, { 'jsonData': jsonText }, function (serverData) {
                alert('传上去了，搞定');
            });
        });

    })
</script>

    <h2>ProjectGantt</h2>
    <button id="btnRefreshGantt">Refresh Gantt</button>
    <button id="btnSaveToServer">SaveToServer</button>
    <label>项目编号</label><%: Model.Id %>

    <div style="width: 800px; height: 480px; position:relative;" id="ganttContainer">    
    </div>

</asp:Content>
